﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupARAssetLoan.aspx.cs" Inherits="MTRC.ODMS.Web.SOM.Popup.PopupARAssetLoan" %>
<%--<%@ Register Src="../UserControl/UCSignature.ascx" TagName="UCSignature" TagPrefix="uc1" %>--%>
<%--<%@ Register Src="../UserControl/UCSignatureNew.ascx" TagName="UCSignatureNew" TagPrefix="ucn" %>--%>
<%@ Register Src="../UserControl/UCAssetLoan.ascx" TagName="UCAssetLoan" TagPrefix="UCAssetLoan" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<%@ Register Assembly="APJ.Web.UI.WebControls" Namespace="APJ.Web.UI.WebControls" TagPrefix="APJ" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %>
<%@ Register Src="~/UserControl/Menu/PageFoot.ascx" TagName="PageFoot" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/TabStrip.ascx" TagName="TabStrip" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/PageHead.ascx" TagName="PageHead" TagPrefix="WebStructure" %>
<%@ Register Src="~/UserControl/Menu/MainMenu.ascx" TagName="MainMenu" TagPrefix="WebStructure" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Operational Data Management System</title>
    <base target="_self" /><!--only _self can close the window, when had signature pic, then clear, it can close the form correctly-->
    <!--base target="_parent"-->
    <meta http-equiv="Expires" content="0" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    
    <link href="<%=ResolveUrl("~/CSS/common.css")%>" rel="stylesheet" type="text/css" />
    <script  type="text/jscript" language="JavaScript" src="../../Javascript/CommonFunction.js"></script> 
    <script type="text/javascript" src="../../Javascript/Menu/MainMenu.js"></script>
<style type="text/css">
    .TableTD1
    {
        height: 30px; 
        width: 100px;
    }
    
    .TableTD2
    {
        height: 30px; 
        width: 200px;
    }
    
    .TableTD3
    {
        height: 30px; 
        width: 100px;
    }
    
    .TableTD4
    {
        height: 30px; 
        width: 350px;
    }
    
    .IconCursor
    {
        cursor: hand;
    }
    
    .IconCursor2
    {
        cursor: default;
    }
</style>
<script type="text/javascript">
function SetParentValueAndClose(assetLoanMainDataTmpID, assetLoanItemDataTmpID)
{
    //debugger;
    //hidContactNo
    dialogArguments.document.getElementById("hidContactNo").value = assetLoanMainDataTmpID;
    //window.close();
}

function InitPageAndSetControlValue()
{   
    var tempStr = dialogArguments.document.getElementById("txtStaffID").value;
    document.getElementById("hdnEmployeeID").value = tempStr;
    document.getElementById("txtStaffIDFromAR").value = tempStr;
 
    //debugger;
    //fixed issue 04444: need show AR No./Highlight/Status-----begin-------------------
    //lblRegistryNumber
    if(dialogArguments.document.getElementById("lblRegistryNumber") != null)
    {
        tempStr = dialogArguments.document.getElementById("lblRegistryNumber").value;
        //document.getElementById("ucAssetLoan_lblAdmissionRegistryEventNoVal").value = tempStr;
        document.getElementById("ucAssetLoan_lblAssetLoanEventNoVal").value = tempStr; ////huangyao 20081127 modifiy in MTR office
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("lblRegistryNumber").innerHTML;
            //document.getElementById("ucAssetLoan_lblAdmissionRegistryEventNoVal").innerText = tempStr;
            document.getElementById("ucAssetLoan_lblAssetLoanEventNoVal").innerText = tempStr; //huangyao 20081127 modifiy in MTR office
        }
    }
    //imgStatus
    tempStr = dialogArguments.document.getElementById("imgStatus").src;
    // document.getElementById("ucAssetLoan_imgAdmissionRegistryEventStatus").src = tempStr; ////huangyao 20081127 modifiy in MTR office
    //imgAssetLoanEventStatus ////huangyao 20081127 modifiy in MTR office
    document.getElementById("ucAssetLoan_imgAssetLoanEventStatus").src = tempStr
    document.getElementById("ucAssetLoan_imgAssetLoanEventStatus").title = dialogArguments.document.getElementById("imgStatus").title;
    
    //imgHighLight
    tempStr = dialogArguments.document.getElementById("imgHighLight").src;
    //document.getElementById("ucAssetLoan_imgAdmissionRegistryEventHighlight").src = tempStr; //huangyao 20081127 modifiy in MTR office
    //imgAssetLoanEventHighLight
    document.getElementById("ucAssetLoan_imgAssetLoanEventHighLight").src = tempStr;
    document.getElementById("ucAssetLoan_imgAssetLoanEventHighLight").title = dialogArguments.document.getElementById("imgHighLight").title;
    //fixed issue 04444: need show AR No./Highlight/Status-----end-------------------
    
    if(dialogArguments.document.getElementById("lblArrivalTime") != null)
    {
        tempStr = dialogArguments.document.getElementById("lblArrivalTime").value;
        document.getElementById("ucAssetLoan_lblAssetLoanEventTimeVal").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("lblArrivalTime").innerHTML;
            document.getElementById("ucAssetLoan_lblAssetLoanEventTimeVal").innerText = tempStr;
        }
        document.getElementById("ucAssetLoan_hdnARArrivalTime").value = tempStr;
    }
    
    //imgStaffType
    //debugger;
    tempStr = dialogArguments.document.getElementById("imgStaffType").src;
    document.getElementById("ucAssetLoan_imgStaffType").src = tempStr;
    document.getElementById("ucAssetLoan_imgStaffType").title = dialogArguments.document.getElementById("imgStaffType").title;
    
    if(dialogArguments.document.getElementById("txtStaffID") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtStaffID").value;
        document.getElementById("ucAssetLoan_txtStaffID").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtStaffID").innerHTML;
            document.getElementById("ucAssetLoan_txtStaffID").innerText = tempStr;
        }
    }
    
    if(dialogArguments.document.getElementById("txtStaffName") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtStaffName").value;
        document.getElementById("ucAssetLoan_txtStaffName").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtStaffName").innerHTML;
            document.getElementById("ucAssetLoan_txtStaffName").innerText = tempStr;
        }
    }
    
    if(dialogArguments.document.getElementById("txtDepartmentCompany") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtDepartmentCompany").value;
        document.getElementById("ucAssetLoan_txtDepartmentCompany").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtDepartmentCompany").innerHTML;
            document.getElementById("ucAssetLoan_txtDepartmentCompany").innerText = tempStr;
        }
    }
    
    if(dialogArguments.document.getElementById("txtOrganizationUnit") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtOrganizationUnit").value;
        document.getElementById("ucAssetLoan_txtOrganizationUnit").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtOrganizationUnit").innerHTML;
            document.getElementById("ucAssetLoan_txtOrganizationUnit").innerText = tempStr;
        }
    }
    
    if(dialogArguments.document.getElementById("txtContactNo") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtContactNo").value;
        document.getElementById("ucAssetLoan_txtContactNo").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtContactNo").innerHTML;
            document.getElementById("ucAssetLoan_txtContactNo").innerText = tempStr;
        }
    }
    
    if(dialogArguments.document.getElementById("txtEstimatedCompletionTime") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtEstimatedCompletionTime").value;
        document.getElementById("ucAssetLoan_txtEstimateCompletionDateTimeInputHrs").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtEstimatedCompletionTime").innerHTML;
            document.getElementById("ucAssetLoan_txtEstimateCompletionDateTimeInputHrs").innerText = tempStr;
        }
    }
    
    tempStr = dialogArguments.document.getElementById("lblShouldCompletionTime").innerHTML;  //can not use value, BKZ, it in UpdatePanel,
    tempStr = dialogArguments.document.getElementById("lblShouldCompletionTime").innerText;
    document.getElementById("ucAssetLoan_lblEstimateCompletionDateTimeVal").innerText = tempStr; //can not use value, BKZ, it in UpdatePanel,
    
    if(dialogArguments.document.getElementById("txtHandoverCheckDetail") != null)
    {
        tempStr = dialogArguments.document.getElementById("txtHandoverCheckDetail").value;
        document.getElementById("ucAssetLoan_txtHandoverNote").value = tempStr;
        if(tempStr == undefined || tempStr == "")
        {
            tempStr = dialogArguments.document.getElementById("txtHandoverCheckDetail").innerHTML;
            document.getElementById("ucAssetLoan_txtHandoverNote").innerText = tempStr;
        }
    }
    
    //chkHandoverCheck //checked
    if(dialogArguments.document.getElementById("chkHandoverCheck").checked)
    {
        //chkHandoverCheck
        document.getElementById("ucAssetLoan_chkHandoverCheck").checked = true;
    }
    
    //Need Get value for, [Status(may be not)], Event Time, StaffID, staffName, Company, Org.Unit, Contact No., Estimate Hrs, Handover CHK and Notes.....
    
    //debugger;
    //----------Set Red * invisible
    //emStaffID
    //document.getElementById("ucAssetLoan_emStaffID").visible = "false";
    //document.getElementById("emStaffID").style.display = "none";
    //emBorrowerName
    //document.getElementById("ucAssetLoan_emBorrowerName").visible = "false";
    //document.getElementById("emBorrowerName").style.display = "none";
    //emDepartmentOrCompany
    //document.getElementById("emDepartmentOrCompany").visible = 'false'; //can no work
    //document.getElementById("emDepartmentOrCompany").style="display:none;" //can no work
    //document.getElementById("emDepartmentOrCompany").style.display = "none";  //only this way can done
    //-----------------------
    
    //debugger;
    //IsServerChanged = false;
}

function UnLoadFunction()
{
    //debugger;
    alert('UnLoadFunction()');
}

function IntialFunction()
{
    //debugger;
    alert('IntialFunction()');
}

function PreRenderFunction()
{
    //debugger;
    alert('PreRenderFunction()');
}

</script>
</head>
<body onload="InitPageAndSetControlValue();"> <%-- onunload="UnLoadFunction();" oninit="IntialFunction();" onprerender="PreRenderFunction();">--%>
    <form id="form1" runat="server">
        <AjaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager" runat="server">
        </AjaxControlToolkit:ToolkitScriptManager>      
        <table width="98%" border="0" cellpadding="0" cellspacing="0" style="margin: 5px;">
            <tr>
                <td>
                    <UCAssetLoan:UCAssetLoan ID="ucAssetLoan" runat="server" />
                </td>
            </tr>
            <tr>
                <td align="right">
                    <asp:button id="btnSaveInAR" runat="server" Class="button" Text="存档" OnClick="btnSaveInAR_Click"></asp:button>
                    <asp:button id="btnCancelInAR" runat="server" Class="button" Text="取消" OnClick="btnCancelInAR_Click"></asp:button>
                    <INPUT type="hidden" id="hdnEmployeeID" name="hdnEmployeeID" runat="server" />
                    <INPUT type="text" id="txtStaffIDFromAR" name="txtStaffIDFromAR" runat="server" style="display: none;" />
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
